package com.travel.controller;

import com.qianfeng.util.ResultMsg;
import com.travel.entity.TbCart;
import com.travel.entity.TbTripOrder;
import com.travel.service.TripOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/adminTripOrder")
public class AdminTripOrderController {
    @Autowired
    TripOrderService tripOrderService;
    /**
     * 查询所有车票订单信息
     * */
    @GetMapping("/getAllTripOrder")
    public ResultMsg getAllTripOrder(@RequestParam(required = false,defaultValue = "1") int current,@RequestParam(required = false,defaultValue = "5") int size){
        return tripOrderService.getAllTripOrder(current,size);
    }
    /**
     * 通过id查询车票订单
     * */
    @GetMapping("/getTripOrderById/{tripTicketId}")
    public ResultMsg getTripOrderById(@PathVariable("tripTicketId") String tripTicketId){
        return tripOrderService.getTripOrderById(tripTicketId);
    }
    /**
     * 修改车票订单
     * */
    @PostMapping("/updateTripOrder")
    public ResultMsg updateTripOrder(@RequestBody TbTripOrder tbTripOrder){
        return tripOrderService.updateTripOrder(tbTripOrder);
    }
    /**
     * 添加车票订单
     * */
    @GetMapping("/addTripOrder")
    public ResultMsg addTripOrder(TbTripOrder tbTripOrder){
        return tripOrderService.addTripOrder(tbTripOrder);
    }
    /**
     * 删除车票订单
     * */
    @GetMapping("/deleteTripOrder/{id}")
    public ResultMsg deleteTripOrder(@PathVariable("id") int id){
        return tripOrderService.deleteTripOrder(id);
    }
}
